<template>
  <div class="page-loading" v-if="isLoading">
    <!-- 加载动画：圆形旋转效果 -->
	<t-image class="image-container"  fit="fill" :src="loading"></t-image>
    <p class="loading-text">加载中...</p>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';
import loading from '@/assets/loading.gif'
// 接收外部控制的加载状态
const props = defineProps({
  isLoading: {
    type: Boolean,
    default: true
  }
});
</script>

<style scoped lang="scss">
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  .spinner {
    // width: 40px;
    // height: 40px;
    // border: 3px solid #f3f3f3;
    // border-top: 3px solid #409eff;
    // border-radius: 50%;
    // animation: spin 1s linear infinite;
  }

  .loading-text {
    margin-top: 16px;
    color: #666;
    font-size: 14px;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
</style>